package com.huawei.zyb.taskManager.domain.developer.valueobject;

/**
 * 开发者角色枚举值对象
 */
public enum DeveloperRole {
    JUNIOR_DEVELOPER("初级开发者", 1),
    DEVELOPER("开发者", 2),
    SENIOR_DEVELOPER("高级开发者", 3),
    TECH_LEAD("技术负责人", 4),
    ARCHITECT("架构师", 5),
    PROJECT_MANAGER("项目经理", 6);

    private final String description;
    private final int level;

    DeveloperRole(String description, int level) {
        this.description = description;
        this.level = level;
    }

    public String getDescription() {
        return description;
    }

    public int getLevel() {
        return level;
    }

    /**
     * 比较角色级别高低
     */
    public boolean isHigherThan(DeveloperRole other) {
        return this.level > other.level;
    }

    /**
     * 比较角色级别高低
     */
    public boolean isLowerThan(DeveloperRole other) {
        return this.level < other.level;
    }

    /**
     * 检查是否可以管理项目
     */
    public boolean canManageProject() {
        return this == PROJECT_MANAGER || this == TECH_LEAD || this == ARCHITECT;
    }

    /**
     * 检查是否可以分配任务
     */
    public boolean canAssignTasks() {
        return this.level >= SENIOR_DEVELOPER.level;
    }

    /**
     * 检查是否为管理角色
     */
    public boolean isManagementRole() {
        return this == TECH_LEAD || this == PROJECT_MANAGER;
    }
}